package com.mt.system.domain {
	
	import mx.collections.ArrayCollection;

	/**      
	 * 文件名称：Permission<br>
	 * 文件描述：<br>
	 * 创建人：马腾<br>
	 * 创建时间：Nov 24, 2012 5:19:07 PM<br>
	 * 修改人：马腾<br>
	 * 修改时间：Nov 24, 2012 5:19:07 PM<br>
	 */
	[RemoteClass(alias="com.mt.system.domain.Permission")]
	public class Permission {
		
		public var id:String;
		public var desc:String;//权限的描述
		public var sn:int;//权限排序
		public var mark:String;//权限标记
		public var parent:Permission;//父权限
		public var menu:Menu;//模块
		public var funct:Funct;//功能
		public var children:ArrayCollection;//子权限
		public var selected:Boolean;
		
		public function equals(obj:Object):Boolean {
			if(obj is Permission){
				return (obj as Permission).id == this.id;
			}
			return false;
		}
		
		public function toString():String{
			return mark + " , " + desc;
		}
		
		public static function includeChild(per:Permission,mark:String):Boolean {
			if(per.mark == mark){
				return true;
			}else{
				for each(var child:Permission in per.children){
					if(child.mark == mark){
						return true;
					}
				}
			}
			return false;
		} 
	}
}